package org.xteam.camllight.str;

import org.xteam.camllight.Atom;
import org.xteam.camllight.Primitive;
import org.xteam.camllight.Value;

public class FillString implements Primitive {

	public Object exec(Object... args) {
		char[] s = (char[])args[0];
		int offset = Value.longVal((Integer)args[1]);
		int len = Value.longVal((Integer)args[2]);
		int c = Value.longVal((Integer)args[3]);
		for (int i = 0; i < len; ++i) {
			s[i+offset] = (char)c;
		}
		return Atom.get(0);
	}

}
